﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using GameEngine.View.Components;

namespace GameEngine.Clients.Silverlight.View.Components
{
    public partial class LevelUC : UserControl, ISilverlightLevelView
    {
        public LevelUC()
        {
            InitializeComponent();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
        }

        public void SetWorldViews(List<IWorldView<int, FrameworkElement>> worlds)
        {
            LayoutRoot.Children.Clear();
            LayoutRoot.RowDefinitions.Clear();
            int i = 0;
            foreach (WorldUC world in worlds) {
                LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
                world.SetValue(Grid.RowProperty, i); 
                world.SetValue(Grid.ColumnProperty, 0);
                LayoutRoot.Children.Add(world);
                i++;
            }
        }
    }
}
